[MINI-OS] Add evtchn_bind_interdomain to mini-os, allowing clients to
authorsos22@douglas.cl.cam.ac.uk <sos22@douglas.cl.cam.ac.uk>
Fri, 28 Jul 2006 13:05:02 +0000 (14:05 +0100)
committersos22@douglas.cl.cam.ac.uk <sos22@douglas.cl.cam.ac.uk>
Fri, 28 Jul 2006 13:05:02 +0000 (14:05 +0100)
bind to interdomain event channels.

Signed-off-by: John D. Ramsdell <ramsdell@mitre.org>
Signed-off-by: Steven Smith <sos22@cam.ac.uk>
extras/mini-os/events.c
extras/mini-os/include/events.h

index dfc1206c2ec9074a0b41b88ac860e12d85e80d89..57e835225df36a28d01d973f25bae40c96127103 100644 (file)
@@ -161,3 +161,23 @@ int evtchn_alloc_unbound(domid_t pal, evtchn_handler_t handler,
     *port = bind_evtchn(op.u.alloc_unbound.port, handler, data);
     return err;
 }
+
+/* Connect to a port so as to allow the exchange of notifications with
+   the pal. Returns the result of the hypervisor call. */
+
+int evtchn_bind_interdomain(domid_t pal, evtchn_port_t remote_port,
+                           evtchn_handler_t handler, void *data,
+                           evtchn_port_t *local_port)
+{
+    evtchn_op_t op;
+    op.cmd = EVTCHNOP_bind_interdomain;
+    op.u.bind_interdomain.remote_dom = pal;
+    op.u.bind_interdomain.remote_port = remote_port;
+    int err = HYPERVISOR_event_channel_op(&op);
+    if (err)
+               return err;
+       evtchn_port_t port = op.u.bind_interdomain.local_port;
+    clear_evtchn(port);              /* Without, handler gets invoked now! */
+    *local_port = bind_evtchn(port, handler, data);
+    return err;
+}
index f0133621f87381bbfe50a089cffe1956eacdce79..cdb6311845254f25b033a6163621053f9d84aa18 100644 (file)
@@ -33,6 +33,9 @@ void unbind_evtchn(evtchn_port_t port);
 void init_events(void);
 int evtchn_alloc_unbound(domid_t pal, evtchn_handler_t handler,
                                                 void *data, evtchn_port_t *port);
+int evtchn_bind_interdomain(domid_t pal, evtchn_port_t remote_port,
+                                                       evtchn_handler_t handler, void *data,
+                                                       evtchn_port_t *local_port);
 
 static inline int notify_remote_via_evtchn(evtchn_port_t port)
 {